const path = require("path");
const { generateTheme } = require("antd-theme-generator");

// ant-design-vue/dist/antd.less
const options = {
  antDir: path.join(__dirname, "../node_modules/ant-design-vue"), // node_modules中的antd目录的路径
  stylesDir: path.join(__dirname, "../src/styles"), // 对应具体位置
  varFile: path.join(__dirname, "../src/styles/variables.less"), // 与主题相关的变量文件的路径
  mainLessFile: path.join(__dirname, "../src/styles/index.less"), // less主文件入口
  themeVariables: [
    // 动态更改的变量列表
    "@primary-color", // 基础颜色
    "@secondary-color",
    "@text-color", // 文本颜色，如果不更改，将会和primary-color保持一致
    "@text-color-secondary",
    "@heading-color",
    "@layout-body-background",
    "@btn-primary-bg",
    "@layout-header-background",
    "@ant-menu-dark",
    "@ant-menu-dark-ant-menu-inline-ant-menu-sub"
  ],
  indexFileName: "index.html",
  outputFilePath: path.join(__dirname, "../public/color.less") // 生成的less文件放入到指定位置，下面会用到此路径
};

generateTheme(options)
  .then(less => {
    console.log("Theme generated successfully");
  })
  .catch(error => {
    console.log("Error", error);
  });
